home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 182_01 / bbscmisc.c < prev    next >
Text File  |  1990-07-30  |  2KB  |  70 lines

  1. /*
  2.     bbscmisc.c
  3.  
  4.     Mike Kelly
  5.  
  6.     06/12/83 v1.0   written
  7.     07/07/83 v1.0   updated
  8. */
  9.  
  10. #include "bbscdef.h"
  11. #include <sys/types.h>
  12. #include <sys/stat.h>
  13.  
  14. #define LASTDATE  " 07/07/83 "
  15.  
  16. #define PGMNAME "BBSCMISC "
  17. #define VERSION " 1.0 "
  18.  
  19.  
  20. strfill(buf,fillchar,length)    /* fill a string with fillchar */
  21. char    *buf;           /*  for length -1 */
  22. int fillchar,
  23.     length;
  24.     {
  25.     while(--length)     /* really is length -1 */
  26.         {
  27.         *buf++ = fillchar;
  28.         }
  29.     *buf++ = '\0';      /* need room for this */
  30.     }
  31.  
  32. substr(from,to,start,length)    /* moves chars from "from" to "to" */
  33. char    *from, *to ;        /*  starting at "start" for */
  34.                     /*  "length" number of chars */
  35. int start, length ;     /* for beginning of string use 1, not 0 */
  36.     {
  37.     int cnt;
  38.  
  39.     cnt = 0;
  40.  
  41.     while(--start)      /* adjust sending field pointer */
  42.         {
  43.         from++;     
  44.         }
  45.  
  46.     while((cnt < length) && (*to++ = *from++))  /* do the moving */
  47.         {
  48.         cnt++;      
  49.         }
  50.     
  51.     *to = '\0';
  52.  
  53.     }
  54.  
  55. char *itoa(str,n)       /* taken from float.c */
  56. char *str;
  57.     {
  58.     char *sptr;
  59.     sprintf(str,"%d",n) ;
  60.     return(str) ;
  61.     }
  62. /*  end of function     */
  63.  
  64. seek(fildes,posit,dummy) int fildes,posit,dummy ;
  65.     {
  66.     return(lseek(fildes,posit << 7,0)) ;
  67.     }
  68. /*  end of function     */
  69.     
  70. /*  end of program      */